{php include pubTemplate("header")}

<script>
    $(document).ready(function() {

        //选择一级区域
        $('#cateid').change(function(){
            $("#select2").html('<img src="'+siteUrl+'public/images/loading.gif" />');
            var cateid = $(this).children('option:selected').val();  //弹出select的值

            if(cateid==0){
                $("#select2").html('');

            }else{

                $.ajax({
                    type: "GET",
                    url:  "{SITE_URL}index.php?app=article&ac=ajax&ts=twocate&referid="+cateid,
                    success: function(msg){
                        $("#select2").html(msg);
                    }
                });

            }

        });

    });
</script>

<div class="container">


    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
            <li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
            <li class="breadcrumb-item"><a href="{tsUrl('article','show',array('id'=>$strArticle['articleid']))}">{$strArticle['title']}</a></li>
            <li class="breadcrumb-item active" aria-current="page">修改文章</li>
        </ol>
    </nav>


<div class="card">
  <div class="card-body">


<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">


<form method="POST" action="{SITE_URL}index.php?app=article&ac=edit&ts=do"  enctype="multipart/form-data">

  <div class="form-group">
    <label>标题：</label>
    <input name="title" type="text" class="form-control" value="{$strArticle['title']}">
  </div>
{if $arrCate}  
  <div class="form-group">
    <label>分类：<small>（如不修改无须选择）</small></label>



      <div class="row">
          <div class="col-6 col-md-6">

              <select id="cateid" name="cateid" class="form-control">
                  <option value="0">选择一级分类</option>
                  {loop $arrCate $key $item}
                  <option value ="{$item['cateid']}">{$item['catename']}</option>
                  {/loop}
              </select>

          </div>
          <div id="select2" class="col-6 col-md-6">



          </div>
      </div>


	
  </div>
{/if}

  <div class="form-group">
    <label>内容：</label>

      <div>
          <textarea id="tseditor"  name="content">{$strArticle['content']}</textarea>
      </div>


  </div>


    <div class="form-group">
        <label>内容概要：</label>
        <textarea class="form-control" name="gaiyao">{$strArticle['gaiyao']}</textarea>
        <div class="c9 pt-1">
            <input type="checkbox" name="re_gaiyao" value="1" checked> 重新生成内容概要
        </div>
    </div>

    <div class="form-group">
    <label>标签：</label>
    <input name="tag" type="text" class="form-control" value="{$strArticle['tag']}">
  </div>

   <div class="form-group">
    <label>封面图片：</label>
	
	{if $strArticle['photo']}
       <p>
	<img  width="200" src="{$strArticle['photo_url']}" />
       </p>
	{/if}

    <div class="custom-file" onchange="imgView()">
        <input id="img-file" type="file" name="photo" class="custom-file-input" accept="image/jpeg,image/png">
        <label class="custom-file-label c9" for="img-file" data-browse="封面图">(支持jpg,png格式；大小640*360px)</label>
    </div>

    <div id="img-view" style="display: none;">
        <img src="" id="img-show" height="200">
    </div>

  </div>


    <div class="form-group">
        <label>查看需要</label>
        <input type="text" name="score" value="{$strArticle['score']}" onkeyup="NumberCheck(this)" /> 积分
    </div>

  
<input type="hidden" name="token" value="{$_SESSION['token']}" />
<input type="hidden" name="articleid" value="{$strArticle['articleid']}" />
<button class="btn btn-sm btn-info" type="submit">修改文章</button>

    <a class="btn btn-outline-secondary btn-sm" href="{tsUrl('article','show',array('id'=>$strArticle['articleid']))}">返回文章</a>
  
</form>


</div>
<div class="col-md-2"></div>
</div>



</div>
</div>





</div>
{php doAction('tseditor')}
{php include pubTemplate("footer")}